package o;

import android.util.Log;
import android.view.View;
import androidx.databinding.ViewDataBinding;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;

public class jn extends jj {
    private List<jj> ˋ = new CopyOnWriteArrayList();
    private List<String> ˎ = new CopyOnWriteArrayList();
    private Set<Class<? extends jj>> ॱ = new HashSet();

    public void ˊ(jj jjVar) {
        if (this.ॱ.add(jjVar.getClass())) {
            this.ˋ.add(jjVar);
            for (jj ˊ : jjVar.ॱ()) {
                ˊ(ˊ);
            }
        }
    }

    public ViewDataBinding ॱ(jk jkVar, View view, int i) {
        for (jj ॱ : this.ˋ) {
            ViewDataBinding ॱ2 = ॱ.ॱ(jkVar, view, i);
            if (ॱ2 != null) {
                return ॱ2;
            }
        }
        if (ˏ()) {
            return ॱ(jkVar, view, i);
        }
        return null;
    }

    public ViewDataBinding ˊ(jk jkVar, View[] viewArr, int i) {
        for (jj ˊ : this.ˋ) {
            ViewDataBinding ˊ2 = ˊ.ˊ(jkVar, viewArr, i);
            if (ˊ2 != null) {
                return ˊ2;
            }
        }
        if (ˏ()) {
            return ˊ(jkVar, viewArr, i);
        }
        return null;
    }

    private boolean ˏ() {
        boolean z = false;
        for (String str : this.ˎ) {
            boolean z2;
            try {
                Class cls = Class.forName(str);
                if (jj.class.isAssignableFrom(cls)) {
                    ˊ((jj) cls.newInstance());
                    this.ˎ.remove(str);
                    z = true;
                }
                z2 = z;
            } catch (ClassNotFoundException e) {
                z2 = z;
            } catch (Throwable e2) {
                Log.e("MergedDataBinderMapper", "unable to add feature mapper for " + str, e2);
                z2 = z;
            } catch (Throwable e22) {
                Log.e("MergedDataBinderMapper", "unable to add feature mapper for " + str, e22);
                z2 = z;
            }
            z = z2;
        }
        return z;
    }
}
